<?php

use think\facade\Db;

/**
 * ClassName:模型操作基类
 * @auditor LeiJunXiang
 * @time 2024/09/26
 */
class ModelOpeBase extends \think\Model
{
    //自动设置时间戳字段
    protected $autoWriteTimestamp = true;
    //主键
    protected $pk = 'objKey';
    // 设置当前模型对应的完整数据表名称
    protected $table = '';
    //对象key
    protected $objKey;




    public function __construct()
    {
        parent::__construct();
        $this->table = basename(str_replace('\\', '/', get_class($this)));
    }

    /**
     * 获取db对象
     * @return void
     */
    protected function getDb(){
        $db = \think\facade\Db::table($this->table);
        return $db;
    }

    /**
     * @return mixed
     */
    public function getObjKey()
    {
        return $this->objKey;
    }

    /**
     * @param mixed $objKey
     */
    public function setObjKey($objKey): void
    {
        $this->objKey = $objKey;
    }



}